//
// Created by ZLY on 2025/5/12.
//

#ifndef HUD_BUTTON_H
#define HUD_BUTTON_H
#include "../affiliate/sprite.h"
#include "../core/object_screen.h"


class HUDButton : public ObjectScreen {
protected:
    Sprite *sprite_normal_ = nullptr;
    Sprite *sprite_hover_ = nullptr;
    Sprite *sprite_pressed_ = nullptr;
    bool is_pressed_ = false;
    bool is_hovered_ = false;
    bool is_trigger_ = false;

public:
    static HUDButton *addHUDButtonChild(Object *parent, glm::vec2 render_pos, const std::string &file_path1,
                                        const std::string &file_path2,
                                        const std::string &file_path3,
                                        float scale = 1.0f, Anchor anchor = Anchor::CENTER);

    void update(float dt) override;

    bool handleEvents(SDL_Event &event) override;

    void checkHover();

    // void setSpriteNormal(Sprite *sprite);
    //
    // void setSpriteHover(Sprite *sprite);
    //
    // void setSpritePressed(Sprite *sprite);

    void setIsTrigger(bool is_trigger) {
        this->is_trigger_ = is_trigger;
    }

    void setIsPressed(bool is_pressed);

    void setIsHovered(bool is_hovered);

    Sprite *getSpriteNormal() {
        return sprite_normal_;
    }

    Sprite *getSpriteHover() {
        return sprite_hover_;
    }

    Sprite *getSpritePressed() {
        return sprite_pressed_;
    }

    bool isTrigger() {
        return is_trigger_;
    }

    bool isPressed() {
        return is_pressed_;
    }

    bool isHover() {
        return is_hovered_;
    }

    void checkState();

    void setScale(float scale);
};


#endif //HUD_BUTTON_H
